1. Field of the Invention
The present invention relates to an automatic gain control circuit for use in an optical code reader for optically reading bar codes or characters.
2. Description of Related Arts
Optical code readers such as bar code readers and optical character readers (OCRs), are widely used to read a variety of codes and symbols through an optical system to be input into computers. There are two types of optical code readers, the laser type scanner and the CCD (Charge Coupled Device) type scanner. The laser type scanners scan a surface for bar codes or characters by using a laser beam and detecting the light reflected from the scanned surface. The CCD type scanners employ an image sensor on the surface of which the optical images are formed by the light reflected from the code surface, and the optical images are scanned electronically.
With such an optical code reader as usually carried by the hand of an operator, in order to ensure that variations in the reading distance between the code display surface and the optical code reader, and resulting variations in the quantity of light reflected by the code display surface, do not degrade the accuracy of the optical code reader, an automatic gain control (AGC) circuit is used. The AGC circuit includes a variable gain amplifier circuit which converts the output of a detection element, such as a photodiode or an image sensor, into a signal with a predetermined amplitude.
FIG. 1 is a block diagram of a general AGC circuit arrangement. A detection element generates an electric signal corresponding to the quantity of light reflected from a code display surface. This signal is input to a variable gain amplifier circuit 10. The output of the variable gain amplifier circuit 10 is supplied to a binary circuit (not shown) which converts the output into a value of [1]or [0]based on a suitable slice level. The output signal of the variable gain amplifier circuit 10 is also fed back to the variable gain amplifier circuit 10 through a peak-holding circuit 12 to control the gain of the variable gain amplifier circuit 10.
The output of the peak-holding circuit 12 quickly increases as the output of the variable gain amplifier 10 increases, whereas when the output of the variable gain amplifier decreases, the output of the peak-holding circuit 12 decreases slowly according to a relatively large time constant. This stabilizes the circuit operation from the turbulent variations of the input signal.
FIG. 2 is a schematic diagram of a variable gain amplifier circuit 10. The variable gain amplifier circuit 10 includes an operational amplifier 14. The inverting input terminal of the operational amplifier 14 receives the output signal from the detection element via a resistor 16. The output signal of the operational amplifier 14 is fed back to the inverting terminal via a field effect transistor 18. The control signal from the peak-holding circuit 12 is input to the gate of the transistor 18. With this arrangement, a reverse-bias voltage is applied between the gate and the source of the transistor 18 creating a variable electric resistance between the drain and the source of the transistor 18 which varies with the gate potential. The gain of the amplifier circuit 10 is thus controlled by the peak-holding circuit 12 which sets the drain to source resistance of the transistor 18.
A large quantity of reflected light causes the output signal of the detection element to increase which causes the gain of the variable gain amplifier circuit 10 to decrease, whereas a small quantity of reflected light causes the output signal of the detection element to decrease which causes the gain of the variable gain amplifier circuit 10 to increase. As a result, the output of the variable gain amplifier circuit 10 remains substantially constant, irrespective of the quantity of light thus reflected from the code display surface. Therefore, variations in the quantity of light received by the detection element, caused by variations in the reading distance, do not degrade the accuracy of the optical code reader.
FIG. 3 is a waveform diagram showing how the circuits of FIGS. 1 and 2 process a signal. FIG. 3(a) shows the input to the variable gain amplifier circuit 10; FIG. 3(b) shows the output from the peak-holding circuit 12; and FIG. 3(c) shows the output from the AGC circuit.
The output signal of the peak-holding circuit 12 follows the variations of the input signal with a period T. As the gain of the variable gain amplifier circuit 10 varies in proportion to the input signal level, the output signal of the variable gain amplifier circuit 10 oscillates corresponding to a code with a substantially constant amplitude as shown in FIG. 3(c).
It is impossible for a conventional optical code reader, as described above, to function when the laser beam is incident on the code display surface in a direction substantially opposite to the reflected light. In this case, the regular reflection light, which is of substantially greater intensity than scattered reflected light, is directly incident on the detection element. The regular reflection light has an intensity from tens to hundreds of times greater than that of the scattered reflected light and consequently the input signal from the detection element to the variable gain amplifier circuit 10 indicates a great peak as shown by the reference number 20.
When a great peak occurs in the input signal from the detection element, the output of the peak-holding circuit 12 sharply rises as shown by the reference number 22 and consequently the gain of the variable gain amplifier circuit 10 becomes extremely small. Because the peak-holding circuit 12 has a relatively large time constant, the output signal from the peak-holding circuit 12 is kept at a large value even after the output signal of the detection element has decreased and the gain of the variable gain amplifier circuit 10 remains extremely small. Therefore, the amplitude of the output from the variable gain amplifier circuit 10 decreases as shown by the reference numeral 24 in FIG. 3(c) and it is impossible for the optical code reader to properly read bar codes or optical characters.
To fix this problem, it may be possible to supply the output of the detection element to the variable gain amplifier circuit 10 via a limiter circuit. However, because the output of the detection element drastically varies with the variation in the quantity of light received, this could increase reading error by the optical code reader by simply cutting off the input signal at a given level.